// Proxy用于修改某些操作的默认行为，即对编程语言进行编程
export const obj = new Proxy({}, {
  get: function (target, propKey, receiver) {
    console.log(`getting key: ${propKey}`)
    return Reflect.get(target, propKey, receiver)
  },
  set: function (target, propKey, value, receiver) {
    console.log(`setting key: ${propKey}`)
    return Reflect.set(target, propKey, value, receiver)
  }
})

// 技巧1 将Proxy对象，设置到object.key属性，从而可以在object对象上调用 new Proxy(target, handler)
// handler是一个空对象，没有任何拦截效果，访问proxy等同于访问target
export const objProxy = { proxy: new Proxy({}, {}) }

